public class HashBuck {
    static class Node{
        public int key ;
        public int val ;
        public Node next ;

        public Node(int key, int val) {
            this.key = key;
            this.val = val;
        }
    }
     public Node[] array ;
    public  int usedSize ;

    public HashBuck() {
        this.array = new Node[10];
    }

    public void put(int key , int val){
          int index = key % array.length;
          Node cur = array[index] ;
         // 先遍历整体的链表，是否存在key
        while (cur != null){
            if(cur.key == key){
                cur.val = val;
                return;
            }
            cur = cur.next;
        }
        //没有这个key
        //使用头插
        Node node = new Node(key , val);
         node.next = array[index] ;
         array[index] = node ;
         usedSize ++ ;

    }
}
